package com.ifast.check.utils;

import java.text.DecimalFormat;

public class ScoreUtil {

    //扫描模块计算安全分数
    public static String calculationScore(int hig, int mid, int low, int warning){

        //计算方法 一个高位漏洞5分  10个中危抵一个高危   10个低危抵一个中危  10个警告抵一个低危
        double score = 100 ;
        score = score - 5*hig - 0.5*mid - 0.05*low - 0.005*warning;
        if (score < 45){
            score = 45;
        }
        DecimalFormat df = new DecimalFormat("#.00");
        String scoreString = df.format(score);
        return scoreString;
    }

    public static void main(String[] args) {
        System.out.println(calculationScore(1,1,1,1));
    }
}
